<?php
ini_set('register_globals', '0');
ini_set('magic_quotes_gpc', '0');
ini_set('magic_quotes_runtime', '0');
/**
 * Added autoload::main
 * added mySkynBlock
 * @author rootciv
 * @version 1.3
 */
class active
{
	public static $actives = array();
	public static $BASE_PATH = './';
	public static $BASE_URL = './';
	public static function autoload($path)
	{
		if(isset(self::$actives["autoload"])){return true;}
		else {
		require self::$BASE_PATH.'/system/active.autoload.php';
		autoload::main($path);
		self::$actives["autoload"] = true;
		}
	}
	public static function system_requirements()
	{
		if(isset(self::$actives["system_requirements"])){return true;}
		else {
			require self::$BASE_PATH.'/system/system_requirements.php';
			self::$actives["system_requeriments"] = true;
		}
	}
	public static function DB()
	{
		if(isset(self::$actives["DB"])){return true;}
		else {
		DB::main(CONFIG_DATA_BASE::$ENGINE.
		':host='.CONFIG_DATA_BASE::$HOST.
		';dbname='.CONFIG_DATA_BASE::$NAME
		,CONFIG_DATA_BASE::$USER
		,CONFIG_DATA_BASE::$PASSWORD);
		self::$actives["DB"] = true;
		}
	}
	public static function TXTAUTH()
	{
		if(isset(self::$actives["TXTAUTH"])){return true;}
		else {
			 require self::$BASE_PATH."/system/active.TXTAUTH.php";
			 TXTAUTH::main();
			self::$actives["TXTAUTH"] = true;
		}
	}
	public static function XAUTH()
	{
		if(isset(self::$actives["XAUTH"])){return true;}
		else {
			 require self::$BASE_PATH."/system/active.XAUTH.php";
			 XAUTH::main();
			self::$actives["XAUTH"] = true;
		}
	}
	public static function chmodPerms()
	{
		if(isset(self::$actives["active_chmodPerms"])){return true;}
		else
		{
			require self::$BASE_PATH.'/system/active_chmodPerms.php';
			self::$actives["active_chmodPerms"] = true;
		}
	}
	public static function plugin()
	{
		if(isset(self::$actives["plugin"])){return true;}
		else
		{
			require self::$BASE_PATH.'/system/active.plugin.php';
			//autoload::import(PLUGIN_PATH);
			self::$actives["plugin"] = true;
		}
	}
	public static function component()
	{
		if(isset(self::$actives["component"])){return true;}
		else
		{
			require(self::$BASE_PATH."/system/active.component.php");
			self::$actives["component"] = true;
		}
	}
	public static function module()
	{
		if(isset(self::$actives["module"])){return true;}
		else
		{
			require(self::$BASE_PATH."/system/active.module.php");
			self::$actives["module"] = true;
		}
	}

	public static function myAlarm($setTemplate = "default")
	{
		if(isset(self::$actives["myAlarm"]))
		{
			if(isset(self::$actives["myAlarm"][$setTemplate]))
			{
				return true;
			}
			else
			{
				myAlarm::setTemplate($setTemplate);
			}
		}
		else
		{
			require self::$BASE_PATH.'/template_alarm/myAlarm.php';
			myAlarm::setTemplate($setTemplate);
			myAlarm::$base_path = self::$BASE_PATH;
			myAlarm::$base_url = self::$BASE_URL;
			self::$actives["myAlarm"] = array($setTemplate=> true);
		}
		mySkyn::assetCss(myAlarm::URL_CSS(),true,null);
		return true;
	}
	public static function myToolBar()
	{
	//echo file_get_contents(self::$BASE_PATH."/template_toolbar/myToolBar.php");
		if(isset(self::$actives["myToolBar"])){return true;}
		else
		{
			require(self::$BASE_PATH."/template_toolbar/myToolBar.php");
			self::$actives["myToolBar"] = true;
		}
	}
	public static function i18n()
	{
		if(isset(self::$actives["i18n"])){return true;}
		else
		{
			self::$actives["i18n"] = true;
			i18n::init( configuration::$PORTAL['LANGUAGE'], self::$BASE_PATH.'/Language');

		}
	}
	/**
	 * @param string $baseURL
	 * @param array $arrayAlias
	 * @return void
	 */
	public static function URI($baseURL, $arrayAlias = array())
	{
		if(isset(self::$actives["URI"])){return true;}
		else
		{
			URI::main($baseURL, $arrayAlias);
			self::$actives["URI"] = true;
		}
	}
	public static function URL($url,$file)
	{
		if(isset(self::$actives["URL"])){return true;}
		else
		{
			require(self::$BASE_PATH."/system/active.URL.php");
			URL::initialize($url, $file);
		}
	}
	public static function mySkyn($path = null,$name_file = null)
	{
		if(isset(self::$actives["mySkyn"])){return true;}
		else
		{
			//require(self::$BASE_PATH."/system/active.mySkynBlock.php");
			require(self::$BASE_PATH."/system/active.mySkyn.php");
			if(is_string($name_file))
			{
				require $path."/$name_file.php";
				mySkyn::$block = new $name_file();
			}
			self::$actives["mySkyn"] = true;
		}
	}
	public static function isActive($name)
	{
		return isset(self::$actives[$name]);
	}
	private static function autoload_plugins($class)
	{
	}
}